import java.io.File;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

/*
ID:luongho3
LANG:JAVA
TASK:job
 */
public class job {
	
	public static int INF = 2100000000;
	public static int nJob, nA, nB;
	public static int[] sA = new int[40];
	public static int[] sB = new int[40];
	public static int[] tA = new int[40];
	public static int[] tB = new int[40];
	public static int[] jA, jB;

	public static void main(String[] args) throws Exception {
		Scanner scanner = new Scanner(new File("job.in"));
		PrintStream ps = new PrintStream(new File("job.out"));
		System.setOut(ps);
		
		nJob = scanner.nextInt();
		
		jA = new int[nJob];
		jB = new int[nJob];
		
		nA = scanner.nextInt();
		nB = scanner.nextInt();
		
		for (int i=0;i<nA;++i) {
			sA[i] = scanner.nextInt();
		}
		
		for (int i=0;i<nB;++i) {
			sB[i] = scanner.nextInt();
		}
		

		for (int i=0;i<nJob;++i ) {
			int min = INF;
			int idx = -1;
			for (int j=0;j<nA;++j) {
				if (sA[j] + tA[j] < min) {
					min = sA[j] + tA[j];
					idx = j;
				}
			}
			tA[idx] += sA[idx];
			jA[i] = tA[idx];
		}
		Arrays.sort(jA);
		
		for (int i=0;i<nJob;++i ) {
			int min = INF;
			int idx = -1;
			for (int j=0;j<nB;++j) {
				if (sB[j] + tB[j] < min) {
					min = sB[j] + tB[j];
					idx = j;
				}
			}
			tB[idx] += sB[idx];
			jB[i] = tB[idx];
		}
		Arrays.sort(jB);
		
		
		int lA, lB;
		lA = jA[nJob-1];
		
		lB = 0;
		for (int i=0;i<nJob;++i) {
			if (jA[i] + jB[nJob-i-1] > lB) {
				lB = jA[i] + jB[nJob-i-1];
			}
		}
		
		System.out.println(lA + " " + lB);
		
		ps.close();
	}
	
	public static int getMax(int a, int b) {
		return a > b ? a : b;
	}
	
	public static int getMin(int a, int b) {
		return a < b ? a : b;
	}
	
}
